<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="<%=request.getContextPath()%>/">
<link rel="stylesheet" href="about/css/bootstrap.min.css">
<link href="about/css/myCss.css" type="text/css" rel="stylesheet">
<link href="about/css/main.css" type="text/css" rel="stylesheet">
<link href="about/css/base.css" type="text/css" rel="stylesheet">
<!--按钮样式表-->
<link href="about/css/btn.css" type="text/css" rel="stylesheet">
<link href="about/css/css.css" type="text/css" rel="stylesheet">
<link href="about/css/index.css" type="text/css" rel="stylesheet">
<link href="about/css/search.css" type="text/css" rel="stylesheet">
<script src="about/js/jquery.min.js"></script>
<script src="about/js/bootstrap.min.js"></script>
<script src="about/js/jQuery.rTabs.js"></script>
<title>设置狐狸对象</title>
</head>
<body>
	<form action="hsz/szhldx/hldxsz.do" method="post">
	<div class="modal fade" id="lnkhxx2" tabindex="-1" role="dialog"
		aria-labelledby="myHeadLabel" aria-hidden="true">
		<div class="modal-dialog" style="width: 90%">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<span class="glyphicon glyphicon-pencil"></span>&nbsp;【楼内住户列表】
				</div>
				<div class="modal-body" style="height: 300px">
					<div class="col-md-12 pd0 fmt5">
					
						<div class="col-md-5 pd0 fmt5">
							<div class="col-md-3 pd5 fmt5">
								<div class="input-group inputWidth_search" style="float: left">
									<input type="text" class="form-control" id="ncx"> <span
										class="input-group-addon"><a
										href="javascript:getNurList();">快速查询</a></span>
								</div>
							</div>
						</div>
						<div class="col-md-2 pd0 fmt5">
							<hr style="width: 2px"></hr>
						</div>
						<div class="col-md-5 pd0 fmt5">
							<div class="col-md-3 pd5 fmt5">
								<div class="input-group inputWidth_search" style="float: left">
									
									<input type="text" class="form-control" id="ckey"> <span
										class="input-group-addon"><a
										href="javascript:getCustomerList();">快速查询</a></span>
								</div>
							</div>
						</div>
					</div>
					<div class="col-md-12 pd0 fmt10">
						<hr class="commonHRCss" />
					</div>
					<div class="col-md-12 pd0 fmt5">
						<div class="col-md-5 pd0 fmt5">
							<div class="col-md-12 pd0">
								<table class="table table-hover">
									<thead>
										<tr>
											<th></th>
											<th>序号</th>
											<th>护士姓名</th>
											<th>联系方式</th>
										</tr>
									</thead>
									<tbody id="hscx">
										
												
									</tbody>
								</table>
							</div>
						</div>
						<div class="col-md-2 pd0 fmt5">
							<hr style="width: 2px"></hr>
						</div>
						<div class="col-md-5 pd0 fmt5">
							<div class="col-md-12 pd0">
								<table class="table table-hover">
									<thead>
										<tr>
											<th></th>
											<th>序号</th>
											<th>客户姓名</th>
											<th>楼栋号</th>
											<th>楼层</th>
											<th>房号</th>
										</tr>
									</thead>
									<tbody id="customerInfo">
										
									</tbody>
								</table>
							</div>
						</div>
					</div>
					
				</div>
				<div class="modal-footer mt20">
					<button type="submit" class="btn btn-primary" >
						确定</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">
						取消</button>
				</div>
			</div>
		</div>
	</div>
	</form>
	<div class="szfwdx2 page">
		<div class="col-md-12 pd20 RightContentBody">
			<form action="hsz/szhldx/nurlist.do" id="form">
				<div class="col-md-3 pd0 fmt5">
					<div class="input-group inputWidth_search">
						<input type="text" class="form-control" name="key"
							placeholder="护士姓名"> <span class="input-group-addon"
							style="padding-left: 15px;"><a
							href="javascript:docment:form.submit()">查询</a></span>
					</div>
				</div>
			</form>
			<div class="col-md-3 pd0 fmt5">
				<button class="btn btn-success open_lnkhxx2" data-toggle="modal"
					data-target="#lnkhxx2" onclick="getNurList();getCustomerList();">设置</button>
			</div>
			<div class="col-md-12 pd0 fmt10">
				<hr class="commonHRCss" />
			</div>
			<div class="col-md-12 pd0 table-responsive">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>护士姓名</th>
							<th>联系电话</th>
							<th></th>
							<th>备注</th>
							<th>操作时间</th>
							<th></th>
						</tr>
					</thead>
					<tbody>
						<c:if var="found" test="${not empty nurInfo.rows}" scope="page">
							<c:forEach var="r" items="${nurInfo.rows}" varStatus="vs">
								<tr>
									<td>${vs.count}</td>
									<td>${r.username}</td>
									<td>${r.phoneNumber}</td>
									<td></td>
									<td>${r.remarks}</td>
									<td><fmt:formatDate value="${r.updateTime}"
											pattern="yyyy-MM-dd" /></td>
									<td></td>
								</tr>
							</c:forEach>
						</c:if>
					</tbody>
				</table>
			</div>
			
			<div class="col-md-12 pd0">
				<div class="col-md-12 text-right pd0 fmt20">
					<nav aria-label="Page navigation">
					<ul class="pagination">
						
						
							<li><a href="hsz/szhldx/nurlist.do?pNo=${nurInfo.pageNo-1}" aria-label="Previous"> <span
									aria-hidden="true">&laquo;</span>
							</a></li>
						

						<c:forEach begin="1" end="${nurInfo.totalPages}" var="r">
							<li><a href="hsz/szhldx/nurlist.do?pNo=${r}">${r}</a></li>
						</c:forEach>
						<c:if test="${nurInfo.pageNo!=nurInfo.totalPages}">
							<li><a href="hsz/szhldx/nurlist.do?pNo=${nurInfo.pageNo+1}" aria-label="Next"> <span
									aria-hidden="true">&raquo;</span>
							</a></li>
							</c:if>
					</ul>
					</nav>
				</div>
			</div>
		</div>
	</div>
	<script>
		var customerInfo = $("#customerInfo");
		var hscx=$("#hscx");
		var ckey=$("#ckey");
		var ncx=$("#ncx");
		function getCustomerList() {
			$.get("api/hsz/szhldx/customerlist", {
				key : ckey.val()
			}, function(resp) {
				if(resp.code==="ok"){
					var html = "";
					for(var i=0;i<resp.data.length;i++){
						html += "<tr>";
						html += "<td><input type='checkbox'name='cId' value='"+resp.data[i].id+"'></td>";
						html += "<td>"+(i+1)+"</td>";
						html += "<td>"+resp.data[i].customerName+"</td>";
						html += "<td>颐养中心1#</td>";
						html += "<td>1层</td>";
						if(resp.data[i].roomNumber!=null){
							html += "<td>"+resp.data[i].roomNumber+"</td>";
						}else{
							html += "<td>无</td>";
						}
						
						html += "</tr>";
					}
					
					customerInfo.html(html);
				}
				
			});
		}
		function getNurList() {
			$.get("api/hsz/szhldx/nurlist", {
				key : ncx.val()
			}, function(resp) {
				if(resp.code==="ok"){
					var html = "";
					console.log(resp);
					for(var i=0;i<resp.data.rows.length;i++){
						html+="<tr>";
						html+="<td><input name='nurId' type='radio' value='"+resp.data.rows[i].id+"'></td>";
						html+="<td>"+(i+1)+"</td>"
						html+="<td>"+resp.data.rows[i].username+"</td>";
						if(resp.data.rows[i].phoneNumber!=null){
							html+="<td>"+resp.data.rows[i].phoneNumber+"</td>"
						}else{
							html+="<td>无</td>"
						}
						html+="</tr>";
					}
					
					hscx.html(html);
				}
			});
		}
	</script>
</body>
</html>
